from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
LENGTH = 3

if rank == 0:
    x = np.linspace(1, 12, size * LENGTH)
else:
    x = None

x_local = np.zeros(LENGTH)

comm.Scatter(x, x_local, root=0)

print(f"Process {rank} x: {x}")
print(f"Process {rank} local x: {x_local}")